package com.yndsoft.jc.ui.shoppingcart;

import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yndsoft.jc.MainActivity;
import com.yndsoft.jc.R;
import com.yndsoft.jc.activity.BaseActivity;
import com.yndsoft.jc.core.ActivitiesManager;

import butterknife.Bind;

/**
 * Created by hasee on 2017/12/5.
 */

public class PaySuccessfulActivity extends BaseActivity implements View.OnClickListener {

    @Bind(R.id.base_backBtn)
    RelativeLayout base_backBtn;
    @Bind(R.id.base_title)
    TextView base_title;
    @Bind(R.id.backTo_mainPage)
    TextView backTo_mainPage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pay_success);

        setViews();
        setListener();
    }

    private void setViews() {
        base_title.setText(getResources().getString(R.string.pay_success));
    }

    private void setListener() {
        base_backBtn.setOnClickListener(this);
        backTo_mainPage.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.base_backBtn:
                finish();
                break;
            case R.id.backTo_mainPage:
                MainActivity mainActivity = (MainActivity) ActivitiesManager.getInstance().getSpecialActivity(MainActivity.class);
                PayForOrderActivity payForOrderActivity = (PayForOrderActivity) ActivitiesManager.getInstance().getSpecialActivity(PayForOrderActivity.class);
                payForOrderActivity.finish();
                ConfirmOrderActivity confirmOrderActivity = (ConfirmOrderActivity) ActivitiesManager.getInstance().getSpecialActivity(ConfirmOrderActivity.class);
                confirmOrderActivity.finish();
                mainActivity.clickIndex();
                finish();
                break;
        }
    }
}
